import { effectScope, ref } from "vue";
export const useCounter = defineStore(() => {
  const count = ref(0);
  function inc() {
    count.value++;
  }
  return { count, inc };
});
function defineStore(fn: () => any) {
  let state: any;
  return () => {
    if (state) return state;
    const scope = effectScope(true);
    return (state = scope.run(fn));
  };
}
